package com.spring.demo.pojo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.Ordered;

/**
 * @version 1.0.0
 * @Date: 2022/5/24 14:39
 * @Author ZhuYouBin
 * @Description
 */
public class CustomProcessorOrder02 implements BeanPostProcessor, Ordered {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("CustomProcessorOrder02: 在init()之前，执行Bean的后置处理器, 当前bean的名称: " + beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("CustomProcessorOrder02: 在init()之后，执行Bean的后置处理器, 当前bean的名称: " + beanName);
        return bean;
    }

    @Override
    public int getOrder() {
        return 5; // 这里设置为5
    }
}
